package frontend.lexer;

public class Token {
    private String content;
    private int lineno;
    private TKType type;

    public Token(TKType type, String content, int lineno) {
        this.type = type;
        this.content = content;
        this.lineno = lineno;
    }

    public Token(Token oldToken) {
        this.content = oldToken.content;
        this.lineno = oldToken.lineno;
        this.type = oldToken.type;
    }

    public Token() {
        this.type = TKType.MAINTK;
        this.lineno = 0;
        this.content = "";
    }

    public String getContent() {
        return content;
    }

    public int getLineno() {
        return lineno;
    }

    public TKType getType() {
        return type;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public void setLineno(int lineno) {
        this.lineno = lineno;
    }

    public void setType(TKType type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Token o) {
            return type.equals(o.type) && lineno == o.lineno && content.equals(o.content);
        } else {
            return false;
        }
    }


}
